/**
 * 名称： 企业文档相关接口
 * 作者： 王景赢
 * 日期： 2024-12-05
 * 对接人： 郭伟
 * 
*/
import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { knowledge, system, aiqa } from '@/api/apiModulesType';
// 新建知识库
export const apiEnterpriseKnowledgeAdd = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/newBuiltKnowLab`,
        method: 'post',
        data: data
    });
};

// 查询知识库
export const apiEnterpriseKnowledgeList = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/queryKnowLab`,
        method: 'get',
        params: query
    });
};

// 编辑知识库
export const apiEnterpriseFilesTreeEditKnowLab = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/editKnowLab`,
        method: 'post',
        data: data
    });
};

// 删除知识库
export const apiEnterpriseFilesTreeDeleteKnowLab = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/deleteKnowLab`,
        method: 'post',
        data: data
    });
};

// 置顶知识库
export const apiEnterpriseFilesTreeTop = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/top`,
        method: 'post',
        data: data
    });
};

// 查询企业文档树树-左边树结构
export const apiTreeFileSelectTree = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/queryTree`,
        method: 'get',
        params: query
    });
};

//查询企业文档树(分页)--右边表格
export const apiTreeFileSelectTreePage = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/queryPaging`,
        method: 'get',
        params: query
    });
};


/////////////////// 成员设置相关接口 /////////////////////
//查询文件用户下角色绑定
export const apiEnterprisePermSelectRoler = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterprisePerm/selectRoler`,
        method: "get",
        params: query
    });
}

// 修改权限
export const apiEnterprisePermUpdateRoler = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterprisePerm/updateRoler`,
        method: "post",
        data: data
    });
}

// 查询用户(无权限)
export const apiuUserQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${system}/user/queryFreePerm`,
        method: "get",
        params: query
    });
}

// 查询部门（无权限）
export const apiuDeptQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${system}/dept/queryFreePerm`,
        method: "get",
        params: query
    });
}

// 查询角色（无权限）
export const apiRoleQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${system}/role/allUnlimited`,
        method: "get",
        params: query
    });
}

// 查询岗位（无权限）
export const apiJobQueryFreePerm = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${system}/post/queryUnlimited`,
        method: "get",
        params: query
    });
}

// 新增角色
export const apiEnterprisePermInertRoler = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterprisePerm/inertRoler`,
        method: "post",
        data: data
    });
}

// 删除权限
export const apiEnterprisePermDeleteRoler = (data?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterprisePerm/deleteRoler`,
        method: "post",
        data: data
    });
}

// 根据参数键名查询参数值
export const apiKnowledgeConfigConfigKey = (id?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${aiqa}/knowledgeConfig/configKey/${id}`,
        method: "get",
    });
}

// 记录知识库点击次数
export const apiEnterpriseFilesTreeAddViews = (query?: any): AxiosPromise<any[]> => {
    return request({
        url: `/${knowledge}/enterpriseFilesTree/addViews`,
        method: "get",
        params: query
    });
}
